import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:location_test/app/data/datasources/local/storage_util.dart';

import 'app/core/di/dependency_injection.dart';
import 'app/core/routes/app_pages.dart';


void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // 初始化本地存储
  await StorageService.init();
  // 注入所有全局服务
  DependencyInjection.init();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: '定位测试',
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [Locale('zh', 'CN'), Locale('en', 'US')],
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent),
      ),
      // 使用GetX的路由
      initialRoute: AppPages.INITIAL,
      getPages: AppPages.routes,
    );
  }
}